import { Layout} from 'antd';
// import { UserOutlined, LaptopOutlined, NotificationOutlined } from '@ant-design/icons';
import './index.css'
import  Header  from '../../components/header.js';
import '../../components/header.css' 

import HealthData from './route'
// import { PoweroffOutlined } from '@ant-design/icons';
import React from 'react';
import { Switch, Route, useHistory,Redirect} from 'react-router';
import LeftMenu from './leftmenu';
import menuInfo from './route'
// import HealthData from './HealthData'
// import loadable from '@loadable/component'; //帮助动态引入


// const { SubMenu } = Menu;
const {Content, Sider } = Layout;

function HeathManege() {
    let his = useHistory();
    // console.log(his);
    // console.log(his.location.pathname);
    const CreateRoute = () => {
        return menuInfo.map((item,index)=>{
            // console.log(item)
            return(
                <Route key={item.menuUrl} path={item.menuUrl} component={item.componentName} />
             )
           })
    }
    return (
        <Layout>
            <Header/>
            <Layout>
                <Sider width={200} className="site-layout-background">
                    <LeftMenu path={his.location.pathname}/>
                </Sider>
                <Layout style={{ padding: '0 24px 24px' }}>
                    <Content
                        className="site-layout-background"
                        style={{
                            padding: 24,
                            margin: 0,
                            minHeight: 280,
                        }}
                    >
                        <Switch>
                     
                            {CreateRoute()}
                            <Redirect to="/home/heathManege/healthData"></Redirect>
                        </Switch>
                    </Content>
                </Layout>
            </Layout>
        </Layout>
    )
}
export default HeathManege;